//
//  SearchDetailsCollectionViewCell.m
//  BeautifulShoppings
//
//  Created by GivenBmli on 16/9/13.
//  Copyright © 2016年 GivenBmli. All rights reserved.
//

#import "SearchDetailsCollectionViewCell.h"
#import "PresentDetailsModel.h"
#import "UIImageView+WebCache.h"
#import "TAMacro.h"
@implementation SearchDetailsCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self creatSubview:frame];
    }
    return self;
}
- (void)setPresentDetailsModel:(PresentDetailsModel *)presentDetailsModel {
    if (_presentDetailsModel != presentDetailsModel) {
         
    }
    self.favorites_count.text = [NSString stringWithFormat:@"%ld",(long)presentDetailsModel.favorites_count];
    [self.cover_image_url sd_setImageWithURL:[NSURL URLWithString:presentDetailsModel.cover_image_url] placeholderImage:[UIImage imageNamed:@"站位"]];
    self.name.text = presentDetailsModel.name;
    self.price.text = presentDetailsModel.price;
}
- (void)creatSubview:(CGRect)frame {
    self.cover_image_url = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH / 2,SCREEN_HEIGHT/3)];
    [self.contentView addSubview:self.cover_image_url];
    
    self.name = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/50, SCREEN_HEIGHT/4 *1.1, SCREEN_WIDTH - SCREEN_WIDTH/10, SCREEN_HEIGHT - SCREEN_HEIGHT/3 *2.5 )];
    self.name.numberOfLines = NO;
    [self.contentView addSubview:self.name];
    self.price = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH /50, SCREEN_HEIGHT /4.1 *1.45, SCREEN_WIDTH / 3, SCREEN_HEIGHT /10  )];
    self.price.textColor = [UIColor redColor];
    [self.contentView addSubview:self.price];
    UIView *viewDown = [[UIView alloc]initWithFrame:CGRectMake(0,SCREEN_HEIGHT-1, SCREEN_WIDTH, 1)];
//    viewDown.backgroundColor = [UIColor blackColor];
    [self.contentView addSubview:viewDown];
    UIView *viewLeft = [[UIView alloc]initWithFrame:CGRectMake(0,0, 1, SCREEN_HEIGHT)];
//    viewLeft.backgroundColor = [UIColor blackColor];
    [self.contentView addSubview:viewLeft];
    UIView *viewRight = [[UIView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH-1,0, 1, SCREEN_HEIGHT)];
//    viewRight.backgroundColor = [UIColor blackColor];
    [self.contentView addSubview:viewRight];
    

}
@end
